Skip to main content

mergAccessoryWrite

Type

command

Summary

This handler requests a write of 'data' on an active session

Syntax

mergAccessoryWrite <pNameAndProtocol>, <pData>, <pCallcackHandler>

Description

The 'pCallbackHandler' will be sent to the owner of the script which opened the session as soon as all data has been sent. Only one pending write request can be active at a time - if an attempt is made to write while one is pending a 'write in progress' error will be thrown. If an error occurs on the socket, or the remote host closes the socket before the read request is satisfied a 'mergAccessoryError' or 'mergAccessoryClosed' message will be sent instead of 'writeMessage' and the socket deleted.

Parameters

NameTypeDescription

pNameAndProtocol

The name as returned by mergAccessoryNames()|the protocol as returned by mergAccesoryProtocols(). For example, "p25i|com.bluebamboo.p25i"

pData

The data to write.

pCallcackHandler

The handler to call when the data is written.

Examples

on printDocket
mergAccessoryOpenSession "p25i|com.bluebamboo.p25i","sessionOpen"
end printDocket

on sessionOpen pNameAndProtocol
mergAccessoryWrite pNameAndProtocol,"Ufwà D"&fld "write","writeCompleted"
end sessionOpen

on writeCompleted pNameAndProtocol
mergAccessoryRead pNameAndProtocol,0,"readCompleted"
end writeCompleted

on readCompleted pNameAndProtocol,pData
if byte 5 of pData = numToByte(3) and byte 6 of pData = numToByte(0) then
answer "print complete"
mergAccessoryCloseSession pName
end if
end readCompleted

Compatibility and Support

Introduced

LiveCode 8.0

OS

ios

Platforms

mobile

Thank you for your feedback!

Was this page helpful?